package DesignPatern.A02_工厂模式.QXB.A02_简单模式;

/**
 * @Author: Du
 * @Date: 2021/7/20 19:44
 */
public class ConcreteCreator extends Creator
{
    @Override
    public <T extends Product> T createProduct(Class<T> c)
    {
        Product product = null;
        try
        {
            product = (Product) Class.forName(c.getName()).newInstance();
        } catch (InstantiationException e)
        {
            e.printStackTrace();
        } catch (IllegalAccessException e)
        {
            e.printStackTrace();
        } catch (ClassNotFoundException e)
        {
            e.printStackTrace();
        }
        return (T) product;
    }
}
